﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace MDIApplication
{
    public partial class AllRoomsReport : Form
    {
        public AllRoomsReport()
        {
            InitializeComponent();
        }

        private void AllRoomsReport_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'AllRmsRptDataSet.Room' table. You can move, or remove it, as needed.
            this.RoomTableAdapter.Fill(this.AllRmsRptDataSet.Room);
            this.reportViewer1.RefreshReport();
            this.reportViewer1.RefreshReport();
        }

        private void monthCalendar1_DateChanged(object sender, DateRangeEventArgs e)
        {
            this.RoomTableAdapter.FillByDate(this.AllRmsRptDataSet.Room, Convert.ToString(monthCalendar1.SelectionStart));
            this.reportViewer1.RefreshReport();
        }

        private void btnsearch_Click(object sender, EventArgs e)
        {
            this.RoomTableAdapter.FillByRoom(this.AllRmsRptDataSet.Room, Convert.ToInt32(tbxsearchrm1.Text));
            this.reportViewer1.RefreshReport();
        }

        private void tbxsearchrm1_TextChanged(object sender, EventArgs e)
        {

        }

        private void tbxsearchrm1_KeyPress(object sender, KeyPressEventArgs e)
        {
            char ch = e.KeyChar;
            if (!Char.IsDigit(ch) && ch != 8)
            {
                e.Handled = true;
                MessageBox.Show("Please Enter Numbers Only", "Error Message");
            }
        }

        private void btnviewall_Click(object sender, EventArgs e)
        {
            this.RoomTableAdapter.Fill(this.AllRmsRptDataSet.Room);
            this.reportViewer1.RefreshReport();
        }
    }
}
